/**
 * @description  场外基金指令(基金简称)
 * @author shenhong
 */
import React, { PureComponent } from 'react';
import { Row, Col } from 'antd';
import { NoDataMaskC } from '../../../../comps';
import style from '../index.less';
class FundName extends PureComponent {
  constructor() {
    super();
    this.state = {
      currentUser: {}, // 当前登录用户信息
    };
  }

  // 金额千分位
  changeNUmu = (num) => {
    let number = '';
    if (num) {
      number = (num * 1).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
    }
    return number;
  };

  render() {
    const { info } = this.props;
    return (
      <div className={style.Fund_Name} style={{ position: 'relative' }}>
        <div>
          <span className='fund_fName'>{`${info && info.chinameabbr ? info.chinameabbr : '基金简称'}`}</span>
          <div className='name_area'>
            <Row style={{ height: '50px', paddingTop: '15px', marginTop: '10px' }}>
              <Col span={6} style={{ paddingLeft: '20px' }}>
                <span className='calue'>{`最新净值\xa0\xa0\xa0\xa0\xa0`}</span>
                <span className='namevalue'>{`${info && info.unitnav ? this.changeNUmu(info.unitnav) : '--'}`}</span>
              </Col>
            </Row>
          </div>
          {info !== undefined ? null : <NoDataMaskC height={'100%'} title='请选择基金代码，加载数据' />}
        </div>
      </div>
    );
  }
}

export default FundName;
